﻿using System;

/// <summary>
/// Summary description for Class1
/// </summary>
public abstract class Shape
{
    public abstract double Area { get; }
    public abstract bool IsValid();
}
public class Rectangle : Shape
{
    public double Width { get; set; }
    public double Height { get; set; }

    public override double Area => Width * Height;

    public override bool IsValid() => Width > 0 && Height > 0;
}

public class Square : Shape
{
    public double Side { get; set; }

    public override double Area => Side * Side;

    public override bool IsValid() => Side > 0;
}

public class Triangle : Shape
{
    public double Base { get; set; }
    public double Height { get; set; }

    public override double Area => 0.5 * Base * Height;

    public override bool IsValid() => Base > 0 && Height > 0;
}

